<?php

/**
 * LoginForm class.
 * LoginForm is the data structure for keeping
 * user login form data. It is used by the 'login' action of 'SiteController'.
 */
class ForgotPasswordForm extends CFormModel
{
	public $username;
	public $verifyCode;

	/**
	 * Declares the validation rules.
	 * The rules state that username and password are required,
	 * and password needs to be authenticated.
	 */
	public function rules()
	{
		return array(
			array('username', 'required'),
			array('username', 'email'),
			array('username', 'exist', 'allowEmpty' => false, 'className' => 'User', 'attributeName' => 'user_login', 'criteria' => array('condition' => 'status="A"')),
			array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements()),
		);
	}

	/**
	 * Declares attribute labels.
	 */
	public function attributeLabels()
	{
		return array(
			'username'	=> t('Email'),
			'verifyCode'	=> t('Verify Code'),
		);
	}
}
